<template>
  <div class="box1">
    <van-list v-model="loading" @load="onLoadList">
      <van-cell
        v-for="item in searList"
        :key="item.id"
        :finished="finished"
        finished-text="没有更多了"
        :title="item.title"
      />
    </van-list>
  </div>
</template>

<script>
import { searchApi } from '@/api'
export default {
  name: 'AAA',
  data() {
    return {
      loading: false,
      page: 1,
      searList: [],
      finished: false
    }
  },
  methods: {
    async onLoadList() {
      const { data } = await searchApi(this.page++, this.$parent.keword)
      this.searList.push(...data.data.results)
      console.log(data)
      if (data.data.results.length === 0) {
        this.finished = true
      }
      this.loading = false
    }
  }
}
</script>

<style scoped lang="less">
.box1 {
  height: calc(100vh - 108px);
  overflow: auto;
}
</style>
